//
//  OADetailCell.m
//  OASystem
//
//  Created by zhoupengfei on 15/3/31.
//  Copyright (c) 2015年 zpf. All rights reserved.
//

#import "OADetailCell.h"
#import "OADetailModel.h"

@implementation OADetailCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
       
    }
    return self;
    
}

+(instancetype)cellWihtTableView:(UITableView*)tableView{
    NSString * cellIdentifier = @"cellIdentifier1";
    OADetailCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier
    ];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"OADetailCell" owner:nil options:nil] lastObject];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    
    return cell;
    
}

-(void)setIndexPath:(NSIndexPath *)indexPath{
    _indexPath = indexPath;
    if (indexPath.section == 0) {
        switch (indexPath.row) {
            case 0:
                self.titleLabel.text = @"文件类型:";
                self.desLabel.text =self.detailModel.selecttemplate;
                //self.textField.text = self.detailModel.source;
                break;
            case 1:
                self.titleLabel.text = @"发文编号:";
                self.desLabel.text =self.detailModel.fwbh;
                // self.textField.text = self.detailModel.fileType;
                break;
            case 2:
                self.titleLabel.text = @"拟稿人:";
                self.desLabel.text =self.detailModel.Gwchecker;
                // self.textField.text = self.detailModel.number;
                break;
            case 3:
                self.titleLabel.text = @"文件标题:";
                self.desLabel.text = self.detailModel.GwSubject;
                // self.textField.text = self.detailModel.receivedSort;
                break;
            case 4:
                self.titleLabel.text = @"机密等级:";
                self.desLabel.text = self.detailModel.GwSecretLevel;
                //  self.textField.text = self.detailModel.title;
                break;
            case 5:
                self.titleLabel.text = @"文种:";
                self.desLabel.text =  self.detailModel.GwFileType;
                 //  self.textField.text = self.detailModel.urgency;
                break;
            case 6:
                self.titleLabel.text = @"共印份数:";
                if ([self.detailModel.Gwprintpapers isEqualToString:@"null"]) {
                    self.detailModel.Gwprintpapers = @"";
                }
                self.desLabel.text = self.detailModel.Gwprintpapers;
               // self.textField.text = self.detailModel.publices;
                break;
            case 7:
                self.titleLabel.text = @"校对人:";
                                self.desLabel.text = self.detailModel.Gwcheck;
               // self.textField.text = self.detailModel.count;
                break;
                       case 8:
                self.titleLabel.text = @"签发日期:";
                self.desLabel.text = self.detailModel.GwIssueDate;
                //  self.textField.text = self.detailModel.receiveDate;
                break;
            case 9:
                self.titleLabel.text = @"发文日期:";
                self.desLabel.text = self.detailModel.GwPrintDate;
                // self.textField.text = self.detailModel.remarks;
                break;
            case 10:
                self.titleLabel.text = @"主题词:";
                self.desLabel.text = self.detailModel.GwTopic;
               // self.textField.text = self.detailModel.officeDone;
                break;
            case 11:
                self.titleLabel.text = @"主送机关:";
                self.desLabel.text = self.detailModel.GwMainSendUnit;
               // self.textField.text = self.detailModel.condition;
                break;
            case 12:
                self.titleLabel.text = @"内网公开:";
                self.desLabel.text = self.detailModel.sendtype ;
               //  self.textField.text = self.detailModel.leaderScan;
                break;
            case 13:
                self.titleLabel.text = @"抄送机关:";
                self.desLabel.text = self.detailModel.GwMainSendUnit;
               // self.textField.text = self.detailModel.sugest;
                break;
                case 14:
                self.titleLabel.text = @"主办单位意见:";
                self.desLabel.text = self.detailModel.flow_yj1;
               // self.textField.text = self.detailModel.sugest;
                break;
                case 15:
                self.titleLabel.text = @"会办单位意见:";
                self.desLabel.text = self.detailModel.flow_yj2;
               // self.textField.text = self.detailModel.sugest;
                break;
                case 16:
                self.titleLabel.text = @"办公室审核意见:";
                self.desLabel.text = self.detailModel.flow_yj3;
               // self.textField.text = self.detailModel.sugest;
                break;
                case 17:
                self.titleLabel.text = @"领导会签:";
                self.desLabel.text = self.detailModel.flow_yj4;
               // self.textField.text = self.detailModel.sugest;
                break;
                case 18:
                self.titleLabel.text = @"领导签发:";
                self.desLabel.text = self.detailModel.flow_yj5;
               // self.textField.text = self.detailModel.sugest;
                break;
               
                
            default:
                self.titleLabel.text = @"";
                self.desLabel.text =@"";
                //self.textField.text = @"";
                break;
        }
    
    }
    else if (indexPath.section == 1){
        self.titleLabel.text = @"";
        self.desLabel.text =@"";
    }else if (indexPath.section == 2){
        self.titleLabel.text = @"";
        self.desLabel.text =@"";
    }

  
}

-(void)editStatus:(BOOL)editor{ //编辑;
    if (editor) {
        if ([[NSString stringWithFormat:@"%@:",self.detailModel.flow] isEqualToString:self.titleLabel.text]) {
            self.textField.hidden = NO;
           // self.desLabel.hidden = NO;
        }else{
            self.textField.hidden = YES;
          //  self.desLabel.hidden = NO;
        }
    }
        else{
        self.textField.hidden = YES;
       // self.desLabel.hidden = NO;
    }
  
}


@end
